import Vue from 'vue'
import Toast from './Toast.vue'

const obj = {
    install() {
        //1.创建toast构造器
        const toastConstructor = Vue.extend(Toast);

        //2.创建组件对象
        const toast = new toastConstructor();

        //3.手动将组件挂在到div元素上
        toast.$mount(document.createElement('div'));

        //4.将元素添加到页面
        document.body.append(toast.$el);

        //5.vue的原型上添加组件对象
        Vue.prototype.$toast = toast;
    }
}

//6.导出
export default obj;